#!/bin/bash
set -e

echo $PATH

mkdir -p /data/mongo/route/logs

mongos -f route/route-27017.conf

mongo --port 27017 << EOF
sh.status() 
sh.addShard("shard1/172.17.0.4:37011,172.17.0.4:37013,172.17.0.4:37015,172.17.0.4:37017"); 
sh.addShard("shard2/172.17.0.4:47011,172.17.0.4:47013,172.17.0.4:47015,172.17.0.4:47017"); 
sh.addShard("shard3/172.17.0.4:57011,172.17.0.4:57013,172.17.0.4:57015,172.17.0.4:57017"); 
sh.addShard("shard4/172.17.0.4:58011,172.17.0.4:58013,172.17.0.4:58015,172.17.0.4:58017"); 
sh.status()
sh.enableSharding("lagou_resume")
sh.shardCollection("lagou_resume.lagou_resume_datas", {"name":"hashed"})
EOF
